package com.zq.it.cms.web.back;

import org.apache.shiro.SecurityUtils;
import org.apache.shiro.subject.Subject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;

import com.zq.it.cms.common.MenuHolder;

@Controller
public class BackController {
	
	@Autowired
	private MenuHolder menuHolder;
	
	@RequestMapping(value = {"", "/", "/index"})
	public String index(ModelMap model){
		Subject subject = SecurityUtils.getSubject();
		if (subject.isAuthenticated()) {
			model.put("menus", menuHolder.getMenus());
			return "index";
		}
		return "login";
	}
	
}
